<?php defined('SYSPATH') or die('No direct access allowed.');

class Model_Fenxiao_Listener extends ORM
{
    public static function order_status_changed($order_sn)
    {
        try {
            if(!$order_sn){
                throw new Exception("订单号不存在");
            }
            $order = Model_Member_Order::order_info($order_sn);
            if(!$order){
                throw new Exception("订单不存在");
            }
            Model_Fenxiao_Commission::pay_commission($order);

            $res = [
                'status' => true,
                'msg' => 'ok',
            ];
        } catch (Exception $excep) {
            $res = [
                'status' => false,
                'msg' => $excep->getMessage(),
            ];
        }

        return $res;
    }
}